package com.gongyibao.gbase.mq.thread;

import javax.jms.Session;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: 张启峰
 * @Date: 2023/4/17 14:48
 * @Description: gyb-
 */

public class MessagesThroughputSend {
    public static void main(String[] args) {
        boolean msgpe = true;// 持久化
        int thrcs = 16;// 线程数
        int msgsz = 1; // 消息大小（k）
        int amount = 100; // 每个线程发送的消息数量
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("开始发送消息" + df.format(new Date()));
        MessagesThroughputSender mSender = new MessagesThroughputSender();
        Session session = mSender.getSession();
        for (int i = 0; i < thrcs; i++) {
            String queuename = "testmsgTPS" + i;// 队列名称
            MessagesThroughputSender sendername = new MessagesThroughputSender(queuename, msgpe, msgsz, amount,
                    session);
            sendername.start();
        }

    }
}